/*
 * Critical kernel based parallel thinning algorithm from 'A New 3D Parallel Thinning Scheme Based on Critical Kernels' by
 * Bertrand and Couprie. Based on the reference implementation by Michel Couprie.
 * Author: Rune Havnung Bakken. 2010.
 */

#ifndef SKELETONISER_KERNEL_CUH
#define SKELETONISER_KERNEL_CUH

/* global thinning kernels */
__global__ void findSimpleVoxels_kernel(const int numCoordinates,unsigned char *voxels,const dim3 volDim,
    unsigned short *coordinatesList_dev);
__global__ void markSurfaceVoxels_kernel(const int numCoordinates,unsigned char *voxels,const dim3 volDim,
    unsigned short *coordinatesList_dev);
__global__ void findSurfaceVoxels_kernel(const int numCoordinates,unsigned char *voxels,const dim3 volDim,
    unsigned short *coordinatesList_dev);

__global__ void unmarkNonSimpleVoxels_kernel(const int numCoordinates,unsigned char *voxels,const dim3 volDim,
    unsigned short *coordinatesList_dev);
__global__ void find2CrucialVoxels_kernel(const int numCoordinates,unsigned char *voxels,const dim3 volDim,
    unsigned short *coordinatesList_dev);
__global__ void find1CrucialVoxelsX_kernel(const int numCoordinates,unsigned char *voxels,const dim3 volDim,
    unsigned short *coordinatesList_dev);
__global__ void find1CrucialVoxelsY_kernel(const int numCoordinates,unsigned char *voxels,const dim3 volDim,
    unsigned short *coordinatesList_dev);
__global__ void find1CrucialVoxelsZ_kernel(const int numCoordinates,unsigned char *voxels,const dim3 volDim,
    unsigned short *coordinatesList_dev);
__global__ void find0CrucialVoxels_kernel(const int numCoordinates,unsigned char *voxels,const dim3 volDim,
    unsigned short *coordinatesList_dev);
__global__ void findUnionOfSets(unsigned char *voxels,unsigned char *result,const dim3 volDim);

/* set comparison kernels */
__global__ void gather_kernel(unsigned char *input,unsigned char *output);
__global__ void projectVolume_kernel(unsigned char *volume,dim3 volDim,unsigned char *yzPlane);
__global__ void findStripCoordinates_kernel(unsigned char *yzPlane,dim3 planeDim,unsigned short *coordinateList,unsigned short *subListLengths);


#endif
